package tjs.study.notes.dotest.proxy.apt;

import java.lang.reflect.Method;

public class DoTest {
    /**
     * 调试请使用remote模式
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        UserInfo userInfo = new UserInfo();

        Method getUserNameMethod = UserInfo.class.getDeclaredMethod("getUserName");
        Method setUserNameMethod = UserInfo.class.getDeclaredMethod("setUserName", String.class);
        System.out.println(getUserNameMethod.invoke(userInfo));//Hellow world!
        System.out.println("调用set方法重置UserName...");
        setUserNameMethod.invoke(userInfo,"Bye world!");
        System.out.println(getUserNameMethod.invoke(userInfo));//Bye world!
    }
}


